//
//  HBActionSheet.m
//  HeartBeat
//
//  Created by karong on 2023/9/5.
//

#import "HBActionSheet.h"
#import "UIView+WSDraw.h"

@interface HBActionSheet ()
@property (weak, nonatomic) IBOutlet UIView *mainView;
@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *btnArray;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *viewBottom;
@end

@implementation HBActionSheet

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.mainView setupRoundedCornersWithCutCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(10, 10)];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void){
        self.viewBottom.constant = 0;
        [self.view uploadLayout];
    });
    self.enableDismissWhenTapBackgroundView = YES;
    for (UIButton * btn in self.btnArray) {
        btn.selected = (btn.tag == appUserCenter.sex);
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (IBAction)sexBtnAction:(UIButton *)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        if (self.selectSexHandle) {
            self.selectSexHandle(sender.tag);
        }
    }];
}

- (IBAction)cencelAction:(id)sender {
    [self dismiss];
}

@end
